import request from "@/utils/request";

const api = '/product-domain/'

/**
 *  产品配置
 * **/
// 新增产品配置
export async function addLoanProduct(params) {
    return await request.post(api + 'loanProduct/addLoanProduct', params)
}

// 新增展期配置
export async function addRollOver(params) {
    return await request.post(api + 'loanProduct/addRollOver', params)
}

// 新增升级规则配置
export async function addUserLoanRules(params) {
    return await request.post(api + 'loanProduct/addUserLoanRules', params)
}

// 资源配置列表
export async function appResourcesControlList(params) {
    return await request.get(api + 'loanProduct/appResourcesControlList', {params})
}

// 产品配置列表
export async function loanProductList(params) {
    return await request.post(api + 'loanProduct/loanProductList', params)
}

// 展期配置列表
export async function rollOverList(params) {
    return await request.post(api + 'loanProduct/rollOverList', params)
}

// 获取展期天数
export async function selectRollOver(params) {
    return await request.get(api + 'loanProduct/selectRollOver', {params})
}

// 资源配置修改
export async function updateAppResourcesControl(params) {
    return await request.post(api + 'loanProduct/updateAppResourcesControl', params)
}

// 产品配置编辑
export async function updateLoanProduct(params) {
    return await request.post(api + 'loanProduct/updateLoanProduct', params)
}

// 产品配置启用禁用
export async function updateLoanProductStatus(params) {
    return await request.post(api + 'loanProduct/updateLoanProductStatus', params)
}

// 展期配置编辑
export async function updateRollOver(params) {
    return await request.post(api + 'loanProduct/updateRollOver', params)
}

// 展期配置启用禁用
export async function updateRollOverStatus(params) {
    return await request.post(api + 'loanProduct/updateRollOverStatus', params)
}

// 产品切换规则状态
export async function updateUserLoanRulesStatus(params) {
    return await request.post(api + 'loanProduct/updateUserLoanRulesStatus', params)
}

// 产品编辑规则
export async function updateUserLoanRules(params) {
    return await request.post(api + 'loanProduct/updateUserLoanRules', params)
}

// 升级规则列表
export async function userLoanRulesList(params) {
    return await request.post(api + 'loanProduct/userLoanRulesList', params)
}

// 升级规则删除
export async function userLoanRulesDelete(params) {
    return await request.get(api + 'loanProduct/userLoanRulesDelete', {params})
}


/**
 * 机审规则
 * **/

// 添加产品规则
export async function addProductRules(params) {
    return await request.post(api + 'rules/addProductRules', params)
}

// 删除产品规则
export async function deleteProductRules(params) {
    return await request.post(api + 'rules/deleteProductRules', params)
}

// 批量删除规则
export async function deleteProductRulesList(params) {
    return await request.post(api + 'rules/deleteProductRulesList', params)
}

// 复用产品规则
export async function reuseProductRules(params) {
    return await request.post(api + 'rules/reuseProductRules', params)
}

// 禁用规则
export async function rulesDisable(params) {
    return await request.post(api + 'rules/rulesDisable', params)
}

// 产品绑定规则列表
export async function selectProductRules(params) {
    return await request.post(api + 'rules/selectProductRules', params)
}

// 机审规则列表
export async function selectRules(params) {
    return await request.post(api + 'rules/selectRules', params)
}

// 修改产品规则
export async function updateProductRules(params) {
    return await request.post(api + 'rules/updateProductRules', params)
}

/**
 * 短信
 * **/
// 查询短信
export async function selectByProductName(params) {
    return await request.get(api + 'selectByProductName', {params})
}

// 修改规则
export async function updateProductSms(params) {
    return await request.post(api + 'updateProductSms', params)
}


/**
 * app列表
 * **/
// 新增
export async function addTenantProduct(params) {
    return await request.post(api + 'product/add', params)
}

// 绑定
export async function bindTenant(params) {
    return await request.post(api + 'product/bindTenant', params)
}

// 审核流程开关
export async function firstTrialSwitch(params) {
    return await request.post(api + 'product/firstTrialSwitch', params)
}

// 关于我们 - 根据名称查询
export async function getAboutByProductName(params) {
    return await request.get(api + 'product/getAboutByProductName', {params})
}

//租户app列表
export async function fetchTenantProductList(params) {
    return await request.post(api + 'product/list', params)
}

//app列表
export async function fetchProductList(params) {
    return await request.post(api + 'loanProduct/list', params)
}

//关于我们 - 新增或者编辑
export async function replaceInsertAbout(params) {
    return await request.post(api + 'product/replaceInsertAbout', params)
}

//编辑产品
export async function updateProduct(params) {
    return await request.post(api + 'product/update', params)
}

//启用禁用App
export async function updateStatusProduct(params) {
    return await request.post(api + 'product/updateProduct', params)
}

//编辑拉黑设置/审核设置/服务项设置/注册设置/进件规则
export async function updateTenantProduct(params) {
    return await request.post(api + 'product/updateProductInfo', params)
}

// app绑定短信 短信列表
export async function fetchProductSmsList(params) {
    return await request.post(api + 'loanProduct/messageList', params)
}

// app绑定短信 短信修改
export async function productSmsUpdate(params) {
    return await request.post(api + 'loanProduct/updateSms', params)
}

// app绑定短信 变量下拉列表
export async function selectSmsVarList(params) {
    return await request.get(api + 'loanProduct/getPoolList', {params})
}

// app绑定短信 短信状态修改
export async function updateSmsStatus(params) {
    return await request.post(api + 'loanProduct/updateStatus', params)
}

// app绑定短信 短信复制其他App
export async function productSmsCopy(params) {
    return await request.post(api + 'loanProduct/updateSmsToAPP', params)
}

/**
 * 租户app综合设置
 * **/
// 查询规则
export async function selectByType(params) {
    return await request.get(api + 'scoreConfig/selectByType', {params})
}

// 查询多头或黑名单或运营商认证设置
export async function selectRiskByType(params) {
    return await request.get(api + 'scoreConfig/selectRiskByType', {params})
}

// 查询第三方产品配置
export async function selectThirdPartyConfig(params) {
    return await request.get(api + 'productConfig/list', {params})
}

// 修改第三方产品配置
export async function updateThirdPartyConfig(params) {
    return await request.post(api + 'productConfig/update', params)
}

//修改多头或黑名单或运营商认证设置
export async function updateRisk(params) {
    return await request.post(api + 'scoreConfig/updateRisk', params)
}

//修改规则
export async function updateScoreConfig(params) {
    return await request.post(api + 'scoreConfig/updateScoreConfig', params)
}

/**
 * 邮件
 * **/
// 查询邮件商户
export async function selectMailMerchant(params) {
    return await request.get(api + 'mail/selectMailMerchant', {params})
}

//修改邮件商
export async function updateMailMerchant(params) {
    return await request.post(api + 'mail/updateMailMerchant', params)
}

/**
 * 产品标签组合
 * **/
// app列表添加标签组合
export async function addProductLabel(params) {
    return await request.post(api + 'productLabel/addLabel', params)
}

// 添加标签组合
export async function addLabelCompose(params) {
    return await request.post(api + 'productLabel/addLibrary', params)
}

// 删除绑定标签组合
export async function deleteProductLabel(params) {
    return await request.post(api + 'productLabel/deleteProductLabel', params)
}

// 复用标签组合
export async function reuseProductLabel(params) {
    return await request.post(api + 'productLabel/reuseLabel', params)
}

// 查询产品已绑定的标签
export async function selectProductBindLabel(params) {
    return await request.get(api + 'productLabel/selectBindLabel', {params})
}

// 获取标签组合列表
export async function fetchLabelComposeList(params) {
    return await request.get(api + 'productLabel/selectLibraryPage', {params})
}

// 查询产品未绑定的标签
export async function selectProductUnbindLabel(params) {
    return await request.get(api + 'productLabel/selectNotBindLabel', {params})
}

// 修改标签组合
export async function updateLabelCompose(params) {
    return await request.post(api + 'productLabel/updateLibrary', params)
}
// 查询创建人
export async function selectLabelCreationName(params) {
    return await request.get(api + 'productLabel/selectCreationName', {params})
}
